<template>
  <div class="EntityOperation ">
    <t-tooltip ref="tooltip" content="编辑" placement="top">
      <t-icon type="border-color" @click.native="toEditPages(dataList.ID)"></t-icon>
    </t-tooltip>
    <t-tooltip content="删除" placement="top">
      <t-poptip confirm title="您确定要删除该数据吗？" @on-ok="ok" @on-cancel="cancel">
        <t-icon type="delete"></t-icon>
      </t-poptip>
    </t-tooltip>
    <t-tooltip content="授权" placement="top">
      <t-icon type="eye-outline" @click.native="toAuthPage(dataList.ID)"></t-icon>
    </t-tooltip>
    <t-tooltip content="禁用" placement="top">
      <t-icon type="eye-outline-off"></t-icon>
    </t-tooltip>
  </div>
</template>
<script>
import http from '../../../http'
import services from '../../../conf/services'
export default {
  props: {
    dataList: Object
  },
  data() {
    return {

    }
  },
  methods: {
    toAuthPage(id) {
      this.$router.push('/roleManage/RoleOperation/' + id)
    },
    toEditPages(id) {
      this.$router.push('/roleManage/edit/' + id)
      this.$refs.tooltip.visible = false
    },
    ok() {
      let datas = {}
      datas.bo = 'user'
      datas.bc = 'USER_ROLE'
      datas.validation_method = 'com.wframe.usermanager.services.valid.RoleDeleteValidator'
      console.log(this.dataList.ID)
      datas.condition = {'ID': this.dataList.ID + ''}
      console.log('----delete>>>>>', datas)
      http.$http.post(services.DELETE_MENU_LIST, datas).then(res => {
        console.log(res)
        let data = res.data
        console.log('-----data>>>>>', data)
        if (data.CODE === 0) {
          // 删除成功
          this.$Message.success('删除角色成功!')
          this.$emit('delete')
        } else {
          this.$Message.danger('删除角色失败!')
        }
      })
    },
    cancel() {

    }
  }
}
</script>
<style lang="scss" scoped>
.EntityOperation  {
  i {
    cursor: pointer;
    margin-right: 10px;
  }
}
</style>

